package com.Dao100;

import java.sql.*;
import com.Model100.*;
import com.Util100.*;


public class AdminDao100 {
	
	public Admin100 login(Connection conn,Admin100 admin)
	{
		
		Admin100 adminRes = null;
		try {		
		String sql = "select * from admin100 where admin100_name=? and admin100_password=?";
		PreparedStatement pstmt= (PreparedStatement)conn.prepareStatement(sql);
		
		pstmt.setString(1,admin.getAdmin100_name());
		
		pstmt.setString(2,admin.getAdmin100_password());
		ResultSet rs = pstmt.executeQuery();
		
		
		while(rs.next())
		{
			adminRes=new Admin100();
			adminRes.setAdmin100_id(rs.getInt("admin100_id"));
			adminRes.setAdmin100_name(rs.getString("admin100_name"));
			adminRes.setAdmin100_phone(rs.getString("admin100_phone"));
			adminRes.setAdmin100_password(rs.getString("admin100_password"));
		}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return adminRes; 
	}



}
